Skip to content

Fix ZRangeArgs Start/Stop ordering for BYSCORE REV in GetWorkflowInstances - #480

Merged
cschleiden merged 4 commits into
cschleiden:mainfrom
DerkSchooltink:fix/zrange-rev-start-stop-ordering
Jun 5, 2026
Merged

Fix ZRangeArgs Start/Stop ordering for BYSCORE REV in GetWorkflowInstances#480
cschleiden merged 4 commits into
cschleiden:mainfrom
DerkSchooltink:fix/zrange-rev-start-stop-ordering

Conversation

@DerkSchooltink

Copy link
Copy Markdown
Contributor

Fixes #479.

Problem

GetWorkflowInstances returns 0 results with go-redis v9.19.0+. go-redis v9.19.0 (#3751) removed the silent Start/Stop swap for ZRANGE BYSCORE REV. Redis requires StartStop when Rev: true; the previous code had them reversed and relied on the library correcting it.

Fix

Swap Start and Stop in the ZRangeArgs call (backend/redis/diagnostics.go).

Tests added

  • Test_Diag_GetWorkflowInstances_Ordering — verifies newest-first ordering across multiple instances
  • Test_Diag_GetWorkflowInstances_Pagination — verifies afterInstanceID pagination returns non-overlapping pages

…ances

go-redis v9.19.0 removed the silent Start/Stop swap for ZRANGE BYSCORE REV.
With Rev: true, Redis requires Start >= Stop (high to low). Correct the argument
order so callers are not broken by go-redis v9.19.0+.
@DerkSchooltink
DerkSchooltink force-pushed the fix/zrange-rev-start-stop-ordering branch from 9983dda to 30eac12 Compare May 5, 2026 08:23
cschleiden
cschleiden previously approved these changes May 25, 2026
@cschleiden
cschleiden enabled auto-merge (rebase) May 25, 2026 03:19
@cschleiden

Copy link
Copy Markdown
Owner

@DerkSchooltink could you take a look at the redis CI test failure?

auto-merge was automatically disabled June 3, 2026 11:24

Head branch was pushed to by a user without write access

@DerkSchooltink
DerkSchooltink force-pushed the fix/zrange-rev-start-stop-ordering branch from a1c18d7 to 830b178 Compare June 3, 2026 11:46
go-redis v9.0.2 internally swapped Start and Stop when Rev: true in
ZRangeArgsCmd.appendArgs. The code fix in this PR (swapping Start/Stop
to match Redis semantics) caused a double-swap against v9.0.2, making
GetWorkflowInstances return empty results.

go-redis v9.19.0 (#3751) removed that silent swap, so the explicit
Start >= Stop ordering in the code now maps directly to the Redis
ZRANGE key max min BYSCORE REV command as intended.
@DerkSchooltink
DerkSchooltink force-pushed the fix/zrange-rev-start-stop-ordering branch from 830b178 to 38bcf41 Compare June 3, 2026 11:48
@DerkSchooltink

DerkSchooltink commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

@DerkSchooltink could you take a look at the redis CI test failure?

seems like I forgot to pin the correct version of Redis, should be fixed now @cschleiden

@cschleiden
cschleiden merged commit 92ebb1a into cschleiden:main Jun 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis backend: GetWorkflowInstances returns no results with go-redis >= v9.19.0

2 participants